//需要拦截器的地方使用instance对象， 有自定义返回逻辑的地方沿用axios，在组件内部处理返回结果即可
import request from '/@/utils/request';

export default function () {
    /**
     * 分页查询
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/QueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 获取请求数
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const getClickFarmingPlanRequestedTimes = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/GetClickFarmingPlanRequestedTimes",
            method: "post",
            data: params,
        });
    };

    /**
     * 获取成功数
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const getOrderSuccessCount = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/GetOrderSuccessCount",
            method: "post",
            data: params,
        });
    };

    /**
     * 查询
     * @returns 返回接口数据
     */
    const queryAll = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/Query",
            method: "get",
            params
        });
    };

    /**
     * 新增
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const addPost = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/Add",
            method: "post",
            data: params,
        });
    };

    /**
    * 更新
    * @param params 要传的参数值
    * @returns 返回接口数据
    */
    const editPost = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/Edit",
            method: "post",
            data: params,
        });
    };

    /**
    * 删除
    * @param params 要传的参数值
    * @returns 返回接口数据
    */
    const deletePost = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductChannelPlan/Delete",
            method: "post",
            data: params,
        });
    };

    return {
        queryRecord,
        queryAll,
        getClickFarmingPlanRequestedTimes,
        getOrderSuccessCount,
        addPost,
        editPost,
        deletePost
    };
}
